/*
 * Created by SharpDevelop.
 * User: David
 * Date: 2006-12-20
 * Time: 03:38
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */

using System;

using Labb4.Pooman.Cards;
using Labb4.Pooman.Players;
using Labb4.Rules;

namespace Labb4.Pooman.Game
{
	/// <summary>
	/// The state of the table during the game's second phase
	/// </summary>
	public class TableGameStatePhase2 : TableGameState
	{
		#region constructors
		
		/// <summary>
		/// Constructor, does nothing
		/// </summary>
		public TableGameStatePhase2() :
			base()
		{
		}
		
		#endregion
		
		#region overrides
		
		/// <summary>
		/// See <see cref="GameState#GetCards">GameState</see>
		/// </summary>
		/// <param name="player">The player who should get cards</param>
		public override void GetCards(Player player)
		{
			if(PoomanRules.Instance.CurrentRound.Plays > 0)
			{
				player.PickupCards(PoomanRules.Instance.CurrentRound.GetAndRemoveBottomPlay());
			}
			
			Table.Instance.RemoveBottomCardPile();
			
			player.CurrentHand.Cards.Sort();
			player.PositionCards();
		}
		
		#endregion
	}
}
